]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Range-check index before array lookup
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 13 Jun 2017 03:39:06 +0000 (05:39 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 13 Jul 2017 15:23:54 +0000 (17:23 +0200)
findMonitorForActor() may be called before the layoutManager gets
to initialize monitors, so make sure the monitor index is in range
to avoid a warning.

https://bugzilla.gnome.org/show_bug.cgi?id=781471

js/ui/layout.js

index aaf9da53678915609ed04e35127be60dbbfb9871..b1e7f94b0c7edf7b627e9bf2f4c80c69d7349cf3 100644 (file)
@@ -896,7 +896,10 @@ const LayoutManager = new Lang.Class({
     },
 
     findMonitorForActor: function(actor) {
-        return this.monitors[this.findIndexForActor(actor)];
+        let index = this.findIndexForActor(actor);
+        if (index >= 0 && index < this.monitors.length)
+            return this.monitors[index];
+        return null;
     },
 
     _queueUpdateRegions: function() {